#ifndef SYSINFOIMPL_H
#define SYSINFOIMPL_H

#include <QtGlobal>
#include <QVector>
#include "SysInfo.h"

#if defined(Q_OS_WIN)

    typedef struct _FILETIME FILETIME;
    class SysInfoWindowsImpl : public SysInfo
    {
    public:
        SysInfoWindowsImpl();
        void init() override;
        //windows下的实现
        double cpuLoadAverage() override;

        //windows下的实现
        double memoryUsed() override;
    private:
        //获取并记录CPU的原始数据
        QVector<qulonglong> cpuRawData();
        //转换时间格式
        qulonglong convertFileTime(const FILETIME& filetime) const;
    private:
        QVector<qulonglong> mCpuLoadLastValues;
    };

#elif defined(Q_OS_LINUX)

    class SysInfoLinuxImpl : public SysInfo
    {
    public:
        SysInfoLinuxImpl();
        void init() override;
        double cpuLoadAverage() override;
        double memoryUsed() override;
    private:
        QVector<qulonglong> cpuRawData();
    private:
        QVector<qulonglong> mCpuLoadLastValues;
    };

#endif

#endif // SYSINFOIMPL_H
